<template>
  <div class="qingdan">
    <div class="qingdan-header">
        <img @click="Back()" class="back" src="../../assets/img/shouye/header-xinpin/back.png" />
      <span>必买清单</span>
      <img class="share" @click="isMore = !isMore" src="../../assets/img/shouye/header-qingdan/更多.png" />
      <ul v-if="isMore">
        <li>
          <router-link :to="{name: 'xiaoxi'}">
            <img src="../../assets/img/shouye/header-qingdan/消息.png" height="30" width="30"/>
            <span>消息</span>
          </router-link>
        </li>
        <li>
          <router-link :to="{name: 'shouye/tuijian'}">
            <img src="../../assets/img/shouye/shouye/shouyeqian.png" alt="">
            <span>首页</span>
          </router-link>
        </li>
        <li @click="isFX = true" >
          <router-link :to="{name: ''}">
            <img src="../../assets/img/shouye/header-qingdan/分享.png" />
            <span>分享</span>
          </router-link>
        </li>
        <li>
          <router-link :to="{name: ''}">
            <img src="../../assets/img/shouye/shouye/gerenqian.png" alt="">
            <span>个人中心</span>
          </router-link>
        </li>
      </ul>
    </div>
    <ul class="shangpin-ul">
      <li>
        <img src="../../assets/img/shouye/shouye-muying/haibao_mamibaobei.png"/>
        <p>奶粉也要玩有机,养成健康北鼻</p>
        <ul class="list-ul">
          <li>
            <img src="../../assets/img/shouye/shouye-muying/naifen.png"/>
            <p>诺优能幼儿配方奶粉</p>
            <h5>¥59</h5>
          </li>
          <li>
            <img src="../../assets/img/shouye/shouye-muying/naifen.png"/>
            <p>诺优能幼儿配方奶粉</p>
            <h5>¥59</h5>
          </li>
          <li>
            <img src="../../assets/img/shouye/shouye-muying/naifen.png"/>
            <p>诺优能幼儿配方奶粉</p>
            <h5>¥59</h5>
          </li>
        </ul>
      </li>
    </ul>
    <ul class="shangpin-ul">
      <li>
        <img src="../../assets/img/shouye/shouye-muying/haibao_mamibaobei.png"/>
        <p>奶粉也要玩有机,养成健康北鼻</p>
        <ul class="list-ul">
          <li>
            <img src="../../assets/img/shouye/shouye-muying/naifen.png"/>
            <p>诺优能幼儿配方奶粉</p>
            <h5>¥59</h5>
          </li>
          <li>
            <img src="../../assets/img/shouye/shouye-muying/naifen.png"/>
            <p>诺优能幼儿配方奶粉</p>
            <h5>¥59</h5>
          </li>
          <li>
            <img src="../../assets/img/shouye/shouye-muying/naifen.png"/>
            <p>诺优能幼儿配方奶粉</p>
            <h5>¥59</h5>
          </li>
        </ul>
      </li>
    </ul>
    <div class="fenxiang-mengban" v-if="isFX">
      <div class="fenxiang">
        <ul>
          <li>
            <ul class="fenxiang-list">
              <li>
                <div>
                  <img src="../../assets/img/shouye/fenxiang/pengyouquan.png"/>
                </div>
                <p>微信朋友圈</p>
              </li>
              <li>
                <div>
                  <img src="../../assets/img/shouye/fenxiang/weixin.png" /></div>
                <p>微信好友</p>
              </li>
              <li>
                <div>
                  <img src="../../assets/img/shouye/fenxiang/QQ.png"/></div>
                <p>QQ好友</p>
              </li>
            </ul>
          </li>
          <li>
            <ul class="fenxiang-list">
              <li>
                <div>
                  <img src="../../assets/img/shouye/fenxiang/QQkongjian.png"/></div>
                <p>QQ空间</p>
              </li>
              <li>
                <div>
                  <img src="../../assets/img/shouye/fenxiang/weibo.png" /></div>
                <p>微博</p>
              </li>
              <li>
                <div>
                  <img src="../../assets/img/shouye/fenxiang/fuzhilianjie.png"/></div>
                <p>复制链接</p>
              </li>
            </ul>
          </li>
        </ul>
        <div @click="quxiao()">
          取消
        </div>
      </div>
    </div>
    <div class="up" @click="toTop()" v-if="isUP">
      <img src="../../assets/img/shouye/tuijian-xuanliyanzhuang/toTop.png"/>
    </div>
  </div>
</template>
<script>
  export default {
    data () {
      return {
        isMore: false,
        isUP: false,
        isFX: false
      }
    },
    methods: {
      Back () {
        this.$router.go(-1);
      },
      toTop () {
        if(document.documentElement){
          document.documentElement.scrollTop = 0;
        }else{
          document.body.scrollTop = 0;
        }
      },
      quxiao () {
        this.isFX = false;
        this.isMore = false
      },
      menu() {
        this.scroll = document.documentElement.scrollTop || document.body.scrollTop;
        if(this.scroll > 0){
          //显示 a 标签
          this.isUP = true;
        }else{
          //隐藏 a 标签
          this.isUP = false;
        }
      },
      top () {
        window.scrollTo(0,0);
      }
    },
    mounted() {
      window.addEventListener('scroll', this.menu)
    },
    created(){
      this.top();
    },
  }
</script>
<style scoped>
  .qingdan {
    background: #f2f2f2;
    width: 100%;
    padding-top: 2rem;
    position: relative;
  }
  .qingdan-header {
    width: 100%;
    height: 2rem;
    line-height: 2rem;
    background: #e53e42;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
  }
  .back {
    vertical-align: middle;
    width: 0.6rem;
    margin-left: 0.5rem;
  }
  .qingdan-header>span{
    font-family: MicrosoftYaHei;
    font-size: 1rem;
    font-weight: normal;
    font-stretch: normal;
    color: #ffffff;
    margin-left: 4.5rem;
  }
  .share {
    vertical-align: middle;
    margin-left: 4rem;
    width: 1.2rem;
  }
  .qingdan-header ul {
    width: 4rem;
    height: 6rem;
    padding: 0 0.3rem;
    background: url("../../assets/img/shouye/header-qingdan/圆角矩形.png")no-repeat 0.1rem -0.1rem;
    /*background-position: 0 0;*/
    background-size: 3.5rem 6rem;
    position: absolute;
    top: 1.5rem;
    right: -0.5rem;
    z-index: 10;
  }
  .qingdan-header ul li {
    height: 1.3rem;
  }
  .qingdan-header ul li img {
    width: 0.6rem;
    height: 0.6rem;
    vertical-align: middle;
  }
  .qingdan-header ul li span {
    font-family: MicrosoftYaHei;
    font-size: 0.5rem;
    font-weight: normal;
    font-stretch: normal;
    color: #4d4d4d;
  }
  .shangpin-ul {
    background: #fff;
    border-bottom: 1px solid #ccc;
    margin-bottom: 0.5rem;
  }
  .shangpin-ul>li{
    width: 100%;
    position: relative;
  }
  .shangpin-ul>li>img{
    width: 100%;
    height: 9rem;
  }
  .shangpin-ul>li>p{
    text-align: center;
    width: 93.5%;
    color: white;
    font-size: 0.8rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    position: absolute;
    top: 5rem;
    left: 0;
  }
  .list-ul {
    display: flex;
    padding: 0 0.5rem;
  }
  .list-ul li{
    flex: 1;
    text-align: center;
  }
  .list-ul li img{
    width: 3rem;
    height: 2rem;
    padding: 0.8rem;
    border: 1px solid #ccc;
  }
  .list-ul li p {
    padding: 0 0.5rem;
    font-family: SimHei;
    font-size: 0.6rem;
    font-weight: normal;
    font-stretch: normal;
    color: #000000;
  }
  .list-ul li h5 {
    font-family: SimHei;
    font-size: 0.7rem;
    font-weight: normal;
    font-stretch: normal;
    color: #e83d41;
  }
  .up {
    width: 1.5rem;
    position: fixed;
    bottom: 0;
    right: 0.3rem;
  }
  .up img {
    width: 100%;
  }
  .fenxiang-mengban {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    background: rgba(0,0,0,0.5);
  }
  .fenxiang {
    padding-top: 1rem;
    background: #fff;
    width: 100%;
    height: 10rem;
    position: absolute;
    bottom: 0;
    left: 0;
  }
  .fenxiang-list {
    display: flex;
  }
  .fenxiang-list li {
    flex: 1;
    text-align: center;
  }
  .fenxiang-list div {
    width: 1.5rem;
    height: 1.5rem;
    margin: 0.5rem auto;
  }
  .fenxiang-list div img {
    width: 100%;
  }
  .fenxiang-list p {
    font-size: 0.6rem;
    font-weight: normal;
    font-stretch: normal;
    color: #4d4d4d;
  }
  .fenxiang>div {
    font-size: 0.6rem;
    font-weight: normal;
    font-stretch: normal;
    background: #e53e42;
    color: #fff;
    width: 3rem;
    text-align: center;
    padding: 0.2rem;
    border-radius: 0.2rem;
    margin: 0.5rem auto;
  }
</style>
